import App from './App'

// #ifndef VUE3
import Vue from 'vue'
import locale from "@/locale/locale.js"
import VueI18n from "vue-i18n"
import './uni.promisify.adaptor'
import uView from "uview-ui"
import store from './store/store'
import getMethod from "./plugin/get.js"
import "./static/webview.js"
import routeInterceptor from '@/utils/route.interceptor.js';
import city from '@/components/city.vue'
import vehicleItem from '@/components/vehicleItem.vue'
import flag from '@/components/flag.vue'
import currency from '@/components/currency.vue'
import { isMessageGo } from '@/utils/tool.js';
import currencyUtils from '@/utils/currency.js'
Vue.prototype.currencyUtils = currencyUtils
Vue.component('city', city)
Vue.component('vehicleItem', vehicleItem)
Vue.component('flag', flag)
Vue.component('currency', currency)
Vue.use(uView)
Vue.config.productionTip = false
App.mpType = 'app'
Vue.use(VueI18n)
uni.$u.config.unit = "rpx"
Vue.prototype.$store = store
Vue.use(getMethod)
Vue.prototype.$imageUrl = "https://gluz-oss.oss-cn-beijing.aliyuncs.com";
Vue.prototype.$webViewUrl = "http://test.gluz.com.cn/#"
routeInterceptor();

Vue.prototype.getImageUrl = (url = '') => {
	if(url.indexOf('://') > -1) {
		return url
	} else {
		return "https://gluz-oss.oss-cn-beijing.aliyuncs.com" + url
	}
};
Vue.prototype.isMessageGo = isMessageGo

Vue.prototype.cback = () => {
	uni.navigateBack()
}


Vue.prototype.toast = (title) => {
	uni.showToast({
		title,
		icon: "none"
	});
}

const i18n = new VueI18n({
	locale: "zh",
	messages: locale
})

const app = new Vue({
	i18n,
	...App
})

app.$mount()
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'

import uView from 'uview-ui'

export function createApp() {
	const app = createSSRApp(App)

	return {
		app
	}
}
// #endif